/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package cn.knet.sp.ncrm.modules.customer.potentialcontactor.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

import cn.knet.sp.ncrm.common.persistence.Page;
import cn.knet.sp.ncrm.common.service.CrudService;
import cn.knet.sp.ncrm.common.utils.StringUtils;
import cn.knet.sp.ncrm.modules.customer.potentialcontactor.dao.PotentialContactorDao;
import cn.knet.sp.ncrm.modules.customer.potentialcontactor.entity.PotentialContactor;

/**
 * 潜在客户主表Service
 * @author gehaiyang
 * @version 2015-08-24
 */
@Service
@Transactional(readOnly = true)
public class PotentialContactorService extends CrudService<PotentialContactorDao, PotentialContactor> {

	public PotentialContactor get(String id) {
		return super.get(id);
	}
	
	public List<PotentialContactor> findList(PotentialContactor potentialContactor) {
		return super.findList(potentialContactor);
	}
	
	public Page<PotentialContactor> findPage(Page<PotentialContactor> page, PotentialContactor potentialContactor) {
		return super.findPage(page, potentialContactor);
	}
	
	@Transactional(readOnly = false)
	public void save(PotentialContactor potentialContactor) {
		Date nowDate = new Date();
		if (StringUtils.isBlank(potentialContactor.getId()))
				potentialContactor.setDateCreated(nowDate);
		potentialContactor.setLastUpdated(nowDate);
		super.save(potentialContactor);
	}
	
	@Transactional(readOnly = false)
	public void delete(PotentialContactor potentialContactor) {
		super.delete(potentialContactor);
	}
	
}